<?php

include_once './log4php/Logger.php';

Logger::configure('./log4j.properties');

$log = Logger::getLogger(__FILE__);

/**
 * This script checks wherther the given client (browser) is supported.
 */
/**
 * BLACKLIST of unsupported browsers:
 * Opera 9:	 "Opera/9.64 (Windows NT 5.1; U; en) Presto/2.1.1"
 * Opera 10: "Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.10"
 * IE 6:	 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
 */
$blacklistArray = array('Opera' => 'Opera', 'MSIE 6.0' => 'Internet Explorer 6');
$blacklistRegExp = implode('|', array_keys($blacklistArray));
$blacklistRegExp = "($blacklistRegExp)";
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$matches = array();
$unsupported = preg_match($blacklistRegExp, $user_agent, $matches);

if ($unsupported) {
    echo '<h1>' . getMessage('app.unsupportedBrowser') . '</H1>';
    echo getMessage('app.supportedBrowsers') . ': Firefox, Safari, Google Chrome, Internet Explorer 7, Internet Explorer 8';
    $log->info("Unsupported browser: $user_agent");
    exit(0);
}

?>
